﻿using System;
using System.Data;

namespace SaleProgram
{
    public static class DataAccess
    {
        public static DataSet FirstPageDataset = new DataSet();
        public static DataSet SecondPageDataset = new DataSet();

        private static DataTable nomberDatatable = new DataTable();
        private static DataTable singleContentDatatable = new DataTable();

        static DataAccess()
        {
            singleContentDatatable.Columns.Add("TeamID", typeof(string));
            singleContentDatatable.Columns.Add("IssuedDate", typeof(DateTime)); //发布日期
            singleContentDatatable.Columns.Add("LoginName", typeof(string));

            singleContentDatatable.Columns.Add("GuestName", typeof(string));
            singleContentDatatable.Columns.Add("GuestAddress", typeof(string));

            singleContentDatatable.Columns.Add("VoyageName", typeof(string));
            singleContentDatatable.Columns.Add("StartDate", typeof(DateTime));
            singleContentDatatable.Columns.Add("EndDate", typeof(DateTime));
            singleContentDatatable.Columns.Add("VoyageType", typeof(string));
            singleContentDatatable.Columns.Add("FlightTrainInfo", typeof(string));
            singleContentDatatable.Columns.Add("PersonalNum", typeof(int));

            singleContentDatatable.Columns.Add("PriceDetail", typeof(string));
            singleContentDatatable.Columns.Add("PriceTotal", typeof(decimal));
            singleContentDatatable.Columns.Add("FirstPayMentDate", typeof(DateTime));
            singleContentDatatable.Columns.Add("SecondPayMentDate", typeof(DateTime));
            singleContentDatatable.Columns.Add("FirstPayMentType", typeof(string));
            singleContentDatatable.Columns.Add("SecondPayMentType", typeof(string));
            singleContentDatatable.Columns.Add("FirstPayMentAmount", typeof(decimal));
            singleContentDatatable.Columns.Add("SecondPayMentAmount", typeof(decimal));
            singleContentDatatable.Columns.Add("TotalPayMentAmount", typeof(decimal));
            singleContentDatatable.Columns.Add("RemainPayMentAmount", typeof(decimal));
            singleContentDatatable.Columns.Add("ExistItem", typeof(string));
            singleContentDatatable.Columns.Add("NoExistItem", typeof(string));

            singleContentDatatable.Columns.Add("HotelInformation", typeof(string));
            singleContentDatatable.Columns.Add("ToursTravel", typeof(string));

            singleContentDatatable.Columns.Add("TotalCurrencySymbol", typeof(string));
            singleContentDatatable.Columns.Add("FirstPayMentAmountCurrencySymbol", typeof(string));
            singleContentDatatable.Columns.Add("SecondPayMentAmountCurrencySymbol", typeof(string));
            singleContentDatatable.Columns.Add("TotalPayCurrencySymbol", typeof(string));
            singleContentDatatable.Columns.Add("RemainPayCurrencySymbol", typeof(string));
            singleContentDatatable.Columns.Add("RemainPayDateTime", typeof(string));

            nomberDatatable.Columns.Add("Titre", typeof(string));
            nomberDatatable.Columns.Add("Nom", typeof(string));
            nomberDatatable.Columns.Add("Prenom", typeof(string));
            nomberDatatable.Columns.Add("passeport", typeof(string));



            /*初始化一行数据*/
            DataRow dr = singleContentDatatable.NewRow();
            dr["TeamID"] = ""; dr["IssuedDate"] = DateTime.Now.ToString("MM/dd/yyyy"); dr["LoginName"] = ""; dr["GuestName"] = ""; dr["GuestAddress"] = "";
            dr["VoyageName"] = ""; dr["StartDate"] = DateTime.Now.ToString("MM/dd/yyyy"); dr["EndDate"] = DateTime.Now.ToString("MM/dd/yyyy"); dr["VoyageType"] = "";
            dr["FlightTrainInfo"] = ""; dr["PersonalNum"] = 0; dr["PriceDetail"] = ""; dr["PriceTotal"] = 0;
            dr["FirstPayMentDate"] = DateTime.Now.ToString("MM/dd/yyyy"); dr["SecondPayMentDate"] = DateTime.Now.ToString("MM/dd/yyyy"); 
            dr["FirstPayMentType"] = "";dr["SecondPayMentType"] = ""; 
            dr["FirstPayMentAmount"] = 0; dr["SecondPayMentAmount"] = 0;dr["TotalPayMentAmount"] = 0; 
            dr["RemainPayMentAmount"] = 0; dr["ExistItem"] = ""; dr["NoExistItem"] = "";
            dr["HotelInformation"] = ""; dr["ToursTravel"] = ""; dr["TotalCurrencySymbol"] = ""; dr["FirstPayMentAmountCurrencySymbol"] = "";
            dr["SecondPayMentAmountCurrencySymbol"] = ""; dr["TotalPayCurrencySymbol"] = ""; dr["RemainPayCurrencySymbol"] = ""; dr["RemainPayDateTime"] = DateTime.Now.ToString("MM/dd/yyyy");
            
            
            singleContentDatatable.Rows.Add(dr);


            nomberDatatable.TableName = "nomberDatatable";
            singleContentDatatable.TableName = "singleContentDatatable";

            FirstPageDataset.Tables.Add(nomberDatatable);
            FirstPageDataset.Tables.Add(singleContentDatatable);
        }  

        public static DataSet GetAllData()
        {

            if (FirstPageDataset != null)
                return FirstPageDataset;
            else
                return null;
        }

        public static void ClearAllData()
        {
            nomberDatatable.Clear();
            singleContentDatatable.Clear();
        }
    }
}
